package com.haiheng.library_base.http

import okhttp3.Interceptor
import java.lang.NullPointerException
import java.util.ArrayList

/**
 *
 * @Des:
 * @Author: hwz
 * @Date:2022/6/2 0002
 * @Version: 1.0
 */
class RetrofitParams {
    /**
     * base url适配器
     */
    private var baseUrlAdapter: BaseUrlAdapter? = null

    constructor(builder: Builder) {
        baseUrlAdapter = builder.baseUrlAdapter
    }

    /**
     * 拦截器
     */
    private val interceptorList: List<Interceptor>? = null

    class Builder {
        var baseUrlAdapter: BaseUrlAdapter? = null
        private val interceptorList: List<Interceptor> = ArrayList()

        fun setBaseUrlAdapter(baseUrlAdapter: BaseUrlAdapter?): Builder {
            if (baseUrlAdapter == null) {
                throw NullPointerException("baseUrlAdapter is null")
            }
            this.baseUrlAdapter = baseUrlAdapter
            return this
        }


        fun build(): RetrofitParams {
            return RetrofitParams(this)
        }
    }


    fun getBaseUrlAdapter(): BaseUrlAdapter? {
        return baseUrlAdapter
    }


}